Repository navigation
Conversation
…the input can be posetive before they are compared
…according to the test
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
hey-hammad
left a comment
There was a problem hiding this comment.
Good effort overall, a few issues requires attention, regarding code quality and test cases. Thanks
|
|
||
| export function isProperFraction(numerator, denominator) { | ||
| // TODO: Implement this function | ||
| if (Math.abs(numerator) < Math.abs(denominator) && numerator !== 0) { |
There was a problem hiding this comment.
If 0,5 is passed to the fn, what is will be the output of the function? is it the correct output?
There was a problem hiding this comment.
also please add the above input as one of the test cases.
| @@ -24,5 +24,52 @@ | |||
| // execute the code to ensure all tests pass. | |||
|
|
|||
| export function getCardValue(card) { | |||
There was a problem hiding this comment.
The overall code is good and works fine, however few things can be improved to make it better.
- do we need to use
letfor defining the suit and cardInput? do we expect the value of these variables to be changed later? If not is there another way of defining the variables that's better suited for this scenario?
| "K", | ||
| ]; | ||
|
|
||
| if (suit == "♠" || suit == "♥" || suit == "♣" || suit == "♦") { |
There was a problem hiding this comment.
Since you already have all the validSuit defined in an array, would it make more sense to check the if the suit already exist in the array rather than checking individually?
| return 10; | ||
| } | ||
| } | ||
| if (card == "invalid") { |
There was a problem hiding this comment.
is it better to perform all the validation before or after any calculations? which is better?
| // TODO: Write tests in Jest syntax to cover all possible outcomes. | ||
|
|
||
| // Case 1: Ace (A) | ||
| test(`Should return 11 when given an ace card`, () => { |
There was a problem hiding this comment.
Since we've added a ton of validation for checking if the input is correct, wouldn't it make more sense to test it to confirm if its working fine?
There was a problem hiding this comment.
Thank you for the constructive feedback . I really appreciate it.
I included tests that prove if the validation works.It is at the bottom the of test file.
There was a problem hiding this comment.
@MaharitB couple of test including malformed inputs like having empty spaces at the start or end of string will make the test suits more robust. Thanks
Learners, PR Template
Self checklist
Task code
CYF-1059
Changelist
I have implemented and wrote tests.
Questions